package com.meicloud.license.appl.configuration;

import com.meicloud.license.appl.vo.LicenseServer;
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * license配置类
 *
 * @author zhanghui145
 * @date 2022/1/10 14:56
 * @since 1.0.0
 */
@Configuration
@ConfigurationProperties(prefix = "license.server")
public class LicenseServerConfiguration {

    private String ip;

    private String port;

    @Bean("licenseServer")
    @ConditionalOnMissingBean
    public LicenseServer createServer(){
        LicenseServer server = new LicenseServer();
        server.setIp(ip);
        server.setPort(port);
        return server;
    }


    public void setIp(String ip) {
        this.ip = ip;
    }

    public void setPort(String port) {
        this.port = port;
    }
}
